﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Project1.View
{
    /// <summary>
    /// DrawTest.xaml 的交互逻辑
    /// </summary>
    public partial class DrawTest : Page
    {
        private int x, y;
        private Rectangle rect;
        public int X { get { return x; }  set { x = value; } }
        public int Y { get { return y; } set { y = value; } }
        public DrawTest()
        {   

            InitializeComponent();
            //Path path = new Path();
            //PathGeometry pathGeometry = new PathGeometry();
            //ArcSegment arc = new ArcSegment(new Point(100, 200), new Size(50, 100), 0, false, SweepDirection.Counterclockwise, true);
            //PathFigure figure = new PathFigure();
            //figure.StartPoint = new Point(100, 0);
            //figure.Segments.Add(arc);
            //pathGeometry.Figures.Add(figure);
            //path.Data = pathGeometry;
            //path.Stroke = Brushes.Orange;
            //testCanvas.Children.Add(path);
            double offset = 0;

            RowDefinition rd = new RowDefinition();
            grid.RowDefinitions.Add(rd);
       

            X = -1000;
            Y = 0;
            rect = new Rectangle()
            {
                Margin = new Thickness(this.X - offset, this.Y - offset, 0, 0),
                Width = 100,
                Height = 200,
                Fill = Brushes.LightGoldenrodYellow,
                Stroke = Brushes.Black,
                StrokeThickness = 1,
                //DataContext = this.Key
                
            };

            rect.MouseLeftButtonDown += new MouseButtonEventHandler(test3_MouseLeftButtonnDown);
            grid.Children.Add(rect);
        }

        private void Ellipse_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            test.Opacity = 1.0;
        }

        private void test3_MouseLeftButtonnDown(object sender,MouseButtonEventArgs e)
        {
            rect.Opacity = rect.Opacity + 1;
            rect.Opacity = (int)rect.Opacity % 2;
        }

        private void test2_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            test2.Opacity = test2.Opacity+1;
            test2.Opacity = (int)test2.Opacity % 2;
        }
    }
}
